package com.example.sys.wx.dao;

import com.example.core.dao.BaseTreeDao;
import com.example.sys.wx.po.SysWxMenu;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.io.Serializable;
import java.util.List;

@Mapper
public interface SysWxMenuDao extends BaseTreeDao<SysWxMenu> {

    @Select("select * from sys_wx_menu where parent_id is null ORDER BY order_num asc ")
    @Override
    List<SysWxMenu> findRoot();

    @Select("select * from sys_wx_menu where parent_id =#{pid} ORDER BY order_num asc ")
    @Override
    List<SysWxMenu> findByPId(@Param("pid") Serializable pid);

    @Select("select * from sys_wx_menu where name =#{name} ")
    public SysWxMenu findByName(@Param("name") String name) throws Exception;
}
